#ifndef __WAV_H__
#define __WAV_H__

#if defined (__cplusplus)
extern "C" {
#endif
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;

/* wav 文件格式 */
typedef struct {
	u_char	Id[4];
	u_int	Len;
}RIFF_t;

typedef struct {
	u_char	Id[4];
	u_int	Len;
	u_short	EncodeType;
	u_short Channels;
	u_int	SampleRate;
	u_int	ByteRate;
	u_short	BlockAlign;
	u_short BitsPerSample;
}FMT_t;

typedef struct {
	u_char	Id[4];
	u_int	Len;
	u_char*	Data;
}FACT_t;

typedef struct {
	RIFF_t	riff;
	u_char	Idw[4];
	FMT_t	fmt;
	FACT_t	fact;
	u_char	Idd[4];
	u_int	Len;
}WAV_t;

int write_wav_head(int fd, WAV_t* wav);
int read_wav_head(int fd, WAV_t* wav);
int printf_wav_head_en(WAV_t wav);
int printf_wav_head_cn(WAV_t wav);

#if defined(__cplusplus)
}
#endif

#endif

